package com.example.mediamoudle.viewpage.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter


class ViewPagerMediaFragmentAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {
    private var dataList = mutableListOf<Fragment>()
    override fun getItemCount(): Int = dataList.size

    override fun createFragment(position: Int): Fragment = dataList[position]
    fun setFragmentList(data: MutableList<Fragment>) {
        dataList.clear()
        this.dataList = data
        notifyDataSetChanged()
    }
}